<template>
  <div>
    <div>
      <div class="hotlist">
        <div class="hotfont">热门搜索</div>
        <ul class="hotSearch">
          <li
            v-for="(hot, index) in hotSearch"
            :key="index"
            @click="$emit('change', hot.first)"
          >
            {{ hot.first }}
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "HotSearch",
  data() {
    return {
      hotSearch: [],
    };
  },
  created() {
    //获取热搜列表
    this.$http.get("/search/hot").then((data) => {
      this.hotSearch = data.data.result.hots;
    });
  },
};
</script>

<style lang="less" scoped>
.hotlist {
  .hotfont {
    margin-bottom: 0.5rem;
    font-size: 14px;
    color: rgb(255, 208, 0);
  }
  padding: 10px;
  .hotSearch {
    display: flex;
    list-style: none;
    overflow: hidden;
    flex-wrap: wrap;
    width: 100%;
    li {
      border: 1px solid rgb(255, 208, 0);
      font-size: 12px;
      border-radius: 15px;
      padding: 5px 12px;
      margin: 6px;
      color: white;
    }
  }
}
</style>
